import asyncio
import time


async def get_html(url):
    print('starting get----')
    await asyncio.sleep(2)
    print('end')


if __name__ == '__main__':
    start = time.time()
    loop = asyncio.get_event_loop()
    # loop.run_until_complete(get_html("http://www.baidu.com"))
    tasks = [get_html("http://www/baidu.com/p/{}".format(i)) for i in range(10)]
    loop.run_until_complete(asyncio.wait(tasks))
    print(time.time() - start)
